# SDL_net simple makefile for mingw
# Author: Ivan Gagis
#         igagis@gmail.com

compiler := g++

srcs := src/sckt.cpp

libname := libsckt.so
iface_ver := 1
lib_ver := 0.1

compiler_flags := -Wall -Wno-comment

$(libname): $(patsubst %.cpp, %.o, $(srcs) )
	@echo Linking $@...
	@$(compiler) -shared $^ -Wl,-soname,$@.$(iface_ver) -o "$@.$(iface_ver).$(lib_ver)" -s
	ln -s $@.$(iface_ver).$(lib_ver) $@.$(iface_ver)
	ln -s $@.$(iface_ver) $@

%.o: %.cpp
	@echo Compiling $<...
	@$(compiler) -c -fPIC -o "$@" $(compiler_flags) $< 

.PHONY clean:
	rm -f src/*.o
	rm -f $(libname)
	rm -f $(libname).$(iface_ver)
	rm -f $(libname).$(iface_ver).$(lib_ver)